package acm.蓝桥贪心杯;

import java.io.IOException;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class A {
    public static int main(int n,int m,int[] arr) {
//        Scanner sc=new Scanner(System.in);
//        int addCouont=sc.nextInt()+1;
//        int subCouont=sc.nextInt();
        int addCouont=n+1;
        int subCouont=m;
        PriorityQueue<Integer> addQueue=new PriorityQueue<>();
        PriorityQueue<Integer> subQueue=new PriorityQueue<>();
        for (int i = 0; i < addCouont + subCouont; i++) {
            if (addQueue.size()<addCouont){
                addQueue.add(arr[i]);
            }else {
                int num =arr[i];
                if (addQueue.peek()<num){
                    addQueue.add(num);
                    subQueue.add(addQueue.poll());
                }else {
                    subQueue.add(num);
                }
            }
        }
        int res=0;
        while (!addQueue.isEmpty()) {
            res+=addQueue.poll();
        }
        while (!subQueue.isEmpty()){
            res-=subQueue.poll();
        }
//        System.out.println(res);
        return res;
    }
}

class Answer{
    static final int N = 200000 + 10;
    static int cnt;

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[] arr=new int[n+m+1];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=sc.nextInt();
        }
        System.out.println(fun(n,m,arr));
    }

    public static int fun(int n,int m,int[] a){
        cnt=0;
        if (m == 0) {
            for (int i = 0; i < n + m + 1; i++)
                cnt += a[i];
        } else {
            Arrays.sort(a, 0, n + m + 1);
            cnt -= a[0];
            cnt += a[n + m];
            for (int i = 1; i < n + m; i++)
                cnt += Math.abs(a[i]);
        }
        return cnt;
    }
}
class Test{
    public static void main(String[] args) throws IOException {
        int count=10000;
        System.out.println();
        while (count-- > 0) {
            int n= (int) (Math.random()*10);
            int m= (int) (Math.random()*10);
            int[] arr=new int[n+m+1];
            for (int i = 0; i < arr.length; i++) {
                arr[i]= (int) ((Math.random()-0.5)*10);
            }

            int a = A.main(n, m, arr);
            int b = Answer.fun(n, m, arr);
            if (a!=b){
                System.out.println(n);
                System.out.println(m);
                System.out.println(Arrays.toString(arr));
                System.out.println("预期："+b);
                System.out.println("实际："+a);
            }
        }
    }
}